/**
 * @include "libs/jquery-1.3.2.js" 
 * @include "utils.js"
 * @include "map.js"  
 */

index = {
	ini:function(){
		$('body').attr('onUnload', 'm.exitMap();');
		
		m.changeSize();
		
		$('#canvas_block').animate({"opacity":0.5});
		$('#canvas').show();
	
		//events	
		$(window).resize(m.changeSize);
		
		$("#share_link").click(m.toggleShare);
		$("#popup_share_button").click(m.hideShare);
	
		index.applyEfectsLinks();
		
		m.ini();
		
		index.ActivateGoogleAnalitycs();
		
	},
	
	applyEfectsLinks:function(){
		$("#share_link").animate({"opacity":0.5});
		$("#share_mail").animate({"opacity":0.5});
		$("#share_fb").animate({"opacity":0.5});
		$("#share_del").animate({"opacity":0.5});
		$("#share_google").animate({"opacity":0.5});
		$("#share_myspac").animate({"opacity":0.5});
		$("#share_live").animate({"opacity":0.5});
		
		
		$("#share_link").hover(index.turnonLink,index.turnoffLink);
		$("#share_mail").hover(index.turnonLink,index.turnoffLink);
		$("#share_fb").hover(index.turnonLink,index.turnoffLink);
		$("#share_del").hover(index.turnonLink,index.turnoffLink);
		$("#share_google").hover(index.turnonLink,index.turnoffLink);
		$("#share_myspac").hover(index.turnonLink,index.turnoffLink);
		$("#share_live").hover(index.turnonLink,index.turnoffLink);
	},
	
	turnonLink:function(){
		$("#"+this.id).animate({"opacity":1});
	},
	turnoffLink:function(){
		$("#"+this.id).animate({"opacity":0.5});
	},
	
	ActivateGoogleAnalitycs:function(){
		if(config.gaKey.length>0 && document.location.hostname!="localhost"){
			var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
			utils.loadJavascript(gaJsHost + "google-analytics.com/ga.js");
			
			try {
				var pageTracker = _gat._getTracker(config.gaKey);
				pageTracker._trackPageview();
			} catch(err) {};
		}
	}
};

$(document).ready(function() {
	index.ini();
});



